import java.util.Scanner;

public class note5rst {
    /*//1.递归打印数字的每一位123-1 2 3
    public static void printnum(int x){
        if(x<10){
            System.out.print(x+" ");
        }
        else{
            printnum(x/10);
            System.out.print(x%10+" ");
        }
    }
    public static void main(String[] args) {
        int x=0;
        Scanner scan=new Scanner(System.in);
        x=scan.nextInt();
        printnum(x);

    }*/



   /* //2.递归求1+2+3+...+10
    public static int sum(int x){
        if(x==1){
            return 1;
        }
        else{
            return x+sum(x-1);
        }
    }
    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        int x=scan.nextInt();
        int ret=sum(x);
        System.out.println(ret);
    }*/



    //3.输入1234，递归求1+2+3+4
    // 输入231，递归求2+3+1
   /* public static int sum(int x){
        if(x<=9){
            return x;
        }
        else {
            return x%10+sum(x/10);
        }
    }
    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        int x=scan.nextInt();
        int ret=sum(x);
        System.out.println(ret);
    }*/




    //4.递归完成汉诺塔
    public static void hanoi(int n,char pos1,char pos2,char pos3){
        if(n==1){
            move(pos1,pos3);
            return;
        }
        hanoi(n-1,pos1,pos3,pos2);
        move(pos1,pos3);
        hanoi(n-1,pos2,pos1,pos3);
    }
    public static void main(String[] args) {
        hanoi(3,'A','B','C');
    }
    public static void move(char posSrc,char posDest){
        System.out.print(posSrc+"->"+posDest+" ");
    }
}

